﻿namespace SolutionFramework
{
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Navigation;
    using SolutionFramework.LoginUI;
    using System.Reflection;
    using Utils;
    using System;
    using Microsoft.Practices.Unity;
    using Hydra.Shell.Interfaces;
    using EnvDTE = Hydra.Shell.Interfaces.EnvDTE;

    /// <summary>
    /// <see cref="UserControl"/> class providing the main UI for the application.
    /// </summary>
    public partial class MainPage : UserControl, IObjectWithSite, EnvDTE.Window
    {
        private IUnknown site;

        /// <summary>
        /// Creates a new <see cref="MainPage"/> instance.
        /// </summary>
        public MainPage()
        {
            var app = (SolutionFramework.App)App.Current;
         
            InitializeComponent();

            app.UIContainer.RegisterInstance<IHydraStatusBar>(this.StatusBar);
        }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            var assembly = Application.Current.GetType().Assembly;
            var attributes = assembly.GetAttributes();

            StatusBar.LegalText = string.Format("{0} v.{1}", attributes.Copyright, attributes.Version);

            CommandBar.ApplicationName = attributes.Product;
            CommandBar.Title = "Welcome";
        }

        public void SetSite(IUnknown pUnkSite)
        {
            site = pUnkSite;
        }

        public bool GetSite(Guid riid, out IUnknown ppvSite)
        {
            ppvSite = site;

            return true;
        }

        public bool GetSite<T>(Guid riid, out T ppvSite)
        {
            throw new NotImplementedException();
        }

        public EnvDTE.Windows Collection
        {
            get { throw new NotImplementedException(); }
        }

        public bool Visible
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public int Left
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public int Top
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public new int Width
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public new int Height
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }
    }
}